/* 
 * File:   AbstractALSource.h
 * Author: RedEyedKiller
 *
 * Created on 23 Αύγουστος 2011, 3:53 πμ
 */

#ifndef ABSTRACTALSOURCE_H
#define	ABSTRACTALSOURCE_H

#ifdef _WIN32
#include <al.h>
#else
#include <AL/al.h>
#endif


namespace al
{

class AbstractALSource
{
public:
    AbstractALSource(ALuint id);
    virtual ~AbstractALSource();

    void Play();
    void Pause();
    virtual void Rewind();
    void Stop();

    bool IsPlaying();
    bool IsPaused();
    bool IsStopped();

    float GetPitch();
    void SetPitch(float pitch);

    float GetGain();
    void SetGain(float gain);

    void SetLooping(bool loop);
    bool IsLooping();

    void SetNumOfLoops(int numOfLoops);
    int GetNumOfLoops() const;

    ALuint GetRawSource();
protected:
    ALuint GetSourceState();

    /**
     * The id provided for this source by openal.
     */
    ALuint sourceId;

    /**
     * The number of loops this source still has.
     */
    int numOfLoops;

private:
    //restrict the use of the default const.
    //children should use AbstractALSource(ALuint id).

    AbstractALSource()
    {
    }
};

};

#endif	/* ABSTRACTALSOURCE_H */

